import java.util.Arrays;

public class SeqList {
    private int[] elem;
    private int usedSize;

    private final static int DEFAULT_CAPACITY = 5;

    public SeqList() {
        elem = new int[DEFAULT_CAPACITY];
    }
    public void display() {
        for (int i = 0; i < usedSize; i++) {
            System.out.print(elem [i]+" ");
        }
        System.out.println();
    }

    public void add(int data) {
        if(isFull()){
            resize();
        }
        elem[usedSize] = data;
        usedSize++;
    }

    private boolean isFull(){
        return usedSize == elem.length;
    }

    private void resize(){
        elem = Arrays.copyOf(elem,2 * elem.length);
    }

    }
